package com.tang.design.single;

/**
 * @author tmh
 * @date 2024/6/4 20:56
 * @description
 */
public class SingleObject {
    //创建一个SingleObject的对象，注意：是静态的
    private static SingleObject singleObject = new SingleObject();

    //私有构造方法
    private SingleObject() {
    }

    //获取唯一可用的对象
    public static SingleObject getInstance() {
        return singleObject;
    }

    //方法
    public void showMessage() {
        System.out.println("hello，world");
    }

}
